package com.atguigu.srb.core.controller.api;


import com.atguigu.srb.base.response.R;
import com.atguigu.srb.core.pojo.entity.BorrowInfo;
import com.atguigu.srb.core.service.BorrowInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 借款信息表 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2023-05-26
 */
@RestController
@Api(tags = "会员借款模块")
@RequestMapping("/api/core/borrowInfo")
public class ApiBorrowInfoController {
    @Resource
    BorrowInfoService borrowInfoService;
    @ApiOperation("会员查询借款申请状态")
    @GetMapping("auth/status")
    public R getStatus(@RequestHeader("token")String token){
        Integer status = borrowInfoService.getStatus(token);
        return R.ok().data("status",status);
    }
    @ApiOperation("会员借款申请")
    @PostMapping("auth/save")
    public R saveBorrowInfo(@RequestBody BorrowInfo borrowInfo,
                            @RequestHeader("token")String token){
        borrowInfoService.saveBorrowInfo(borrowInfo,token);
        return R.ok();
    }

}

